const { api, isMock, proxy, moduleName } = require('env.cfg')

const needProxy = (proxy && proxy['needOpen']) || isMock
const moduleCfg = window[moduleName]
const staticHost = moduleCfg && moduleCfg.staticHost ? moduleCfg.staticHost : ''
const host = moduleCfg && moduleCfg.apiHost ? moduleCfg.apiHost : ''

const apiHost = (needProxy ? '' : host) + api
const commHost = needProxy ? '' : host
// console.info('apiHost:', apiHost)

export default {
  enUrl: moduleCfg && moduleCfg.enUrl ? moduleCfg.enUrl : '',
  resourceUrl: `${staticHost}`,
  userLogin: `${apiHost}/auth/login`,
  userLogout: `${apiHost}/auth/logout`,
  userModifyPass: `${apiHost}/user/modifyPass`,

  uploadFile: `${commHost}/upload/file`,

  getCustomerPage: `${apiHost}/customer/page`,
  addCustomer: `${apiHost}/customer/add`,
  updateCustomer: `${apiHost}/customer/update`,
  checkCode: `${apiHost}/customer/check/code`,
  getCustomerById: `${apiHost}/customer`,
  deleteCustomer: `${apiHost}/customer/delete`,

  getCustomerProjectList: `${apiHost}/customer/project_list`

}
